package astri.pdcontrol.commclient;


/**
 * Class that holds the configuration of ASTRI CommClient. 
 * @author Echo@ASTRI
 *
 */
public final class AstCommClientConfig {
	/**
	 * Discovery IP for UDP multicast
	 */
	public String			discoveryIpAddr;
	/**
	 * Discovery Port for UDP multicast
	 */
	public int				discoveryPort;
	/**
	 * interval (in ms) for sending discovery message, UDP
	 */
	public int				discoveryInterval;	
	/**
	 * Default timeout value for send timeout
	 */
	public int				clientTimeout;
	/**
	 * Default Timeout from Server (in msec), e.g. read Timeout, connect Timeout
	 */
	public int				serverTimeout;
	/**
	 * Message Endian match with server
	 */
	public int				messageEndian;
	/**
	 * Message Magic match with server
	 */
	public int      		messageMagic;
	
	/**
	 * Event listener to handle event from AstCommClient
	 */
	public AstCommClientListener listener;
	
	
//	int				m_connectPort;      // the base port for connecting HMC(home media center) [For UPnP]
//	int				m_connectInterval;  // interval (in milisecond) for connect/reconnect      [For UPnP]
//	int         	m_bUseHttpTunnel;       // whether to enable http tunnel

	
	/**
	 * AstCommClientConfig constructor with default configuration.
	 */
	public AstCommClientConfig() {		
		discoveryIpAddr   		= defines.ASTCOMM_DEFAULT_DISCOVERYGROUP;
		discoveryPort     		= defines.ASTCOMM_DEFAULT_DISCOVERYPORT;        
		discoveryInterval 	    = defines.ASTCOMM_DEFAULT_DISCOVERYINTERVAL;
		clientTimeout 			= defines.ASTCOMM_DEFAULT_CLIENT_TIMEOUT;       
		serverTimeout			= defines.ASTCOMM_DEFAULT_SERVER_TIMEOUT;  
		messageEndian 			= defines.ASTCOMM_DEFAULT_ENDIAN;   
		messageMagic			= defines.ASTCOMM_MESSAGE_MAGIC;
	    
		listener 					= null;
//		m_connectPort             = 0;         
//		m_connectInterval 		= 5000;  
//		m_bUseHttpTunnel 			= 1;
	    
	}
	
	/**
	 * AstCommClientConfig constructor with default configuration and input listener.
	 * @param confListener the target listener that the CommClient is going to be set to.
	 */
	public AstCommClientConfig(AstCommClientListener confListener) {		
		this();
		setListener(confListener);
	}
	
	/**
	 * Method to set the listener of the CommClient
	 * @param confListener the target listener that the CommClient is going to be set to.
	 */
	public void setListener(AstCommClientListener confListener) {
		listener				= confListener;
	}
}